#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int main() {
    int a[50], i, cout = 0, total = 0;
    char c;
    for (i = 0; c = getchar() != ']'; i++) {
        scanf("%d", &a[i]);
        total++;
    }
    int max = a[0];
    int min = a[0];
    for (i = 0; i < total; i++) {
        if (max < a[i]) {
            max = a[i];
        }
        if (min > a[i]) {
            min = a[i];
        }
    }
    cout = total;
    for (i = 0; i < total; i++) {
        if (max == a[i] || min == a[i]) {
            cout--;
        }
    }
    printf("%d", cout);
    return 0;
}